package com.obst.tracenote;


import com.obst.tracenote.util.MyPreferences;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

public class TracenoteActivity extends Activity {
	int value = 0;
	Handler mHandler;
	private String mFacebookAccessToken;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		mFacebookAccessToken = MyPreferences.getAppPreferences(this,
				"FACEBOOK_TOKEN");
		mHandler = new Handler() {
			public void handleMessage(Message msg) {
				value++;

				if (value < 1) {
					mHandler.sendEmptyMessageDelayed(0, 1000);

				} else {
					finish();
					Intent intent = null;
					if (!"".equals(mFacebookAccessToken)
							&& mFacebookAccessToken != null) {
						intent = new Intent(TracenoteActivity.this, MainAct.class);
					} else {
						intent = new Intent(TracenoteActivity.this,
								LoginAct.class);
					}
					startActivity(intent);
				}

			}
		};
		mHandler.sendEmptyMessage(0);
	}
}